home *** CD-ROM | disk | FTP | other *** search
Wrap
-------------------------------------------------------------------------------- -- Shaft by Holzchopf -------------------------------------------------------------------------------- -- setup if cc==nil then cc={} end cc.shaft={} -- load ressources cc.shaft.gfx_icn=loadgfx("weapons/shaft.png") -- Weapon Image setmidhandle(cc.shaft.gfx_icn) cc.shaft.gfx_wpn=loadgfx("buildings/shaftpart.png") -- Weapon Image setmidhandle(cc.shaft.gfx_wpn) cc.shaft.sfx_build=loadsfx("crumble.ogg") -------------------------------------------------------------------------------- -- Weapon -------------------------------------------------------------------------------- cc.shaft.id=addweapon("cc.shaft","Shaft",cc.shaft.gfx_icn,0) cc.shaft.ammo=5 function cc.shaft.draw() -- Draw -- HUD Positioning if weapon_shots==0 then hudpositioning(pos_build,cc.shaft.gfx_wpn,100,0,1) end end function cc.shaft.attack(attack) -- start if (weapon_mode==0) and (weapon_position==1) then if weapon_x>getplayerx(0) then weapon_mode=1 else weapon_mode=-1 end -- No more weapon switching! useweapon(0) -- Make sure that there is enough round time secondsleft=math.floor(getframesleft()/50) changeturntime(30-secondsleft) end -- Build (auto!) if weapon_mode~=0 then if weapon_timer>=10 then weapon_timer=0 weapon_shots=weapon_shots+1 end -- end if necessary if (weapon_shots>=cc.shaft.ammo) then endturn() else -- place shaft part if weapon_timer==0 then -- check place if collision(cc.shaft.gfx_wpn,weapon_x,weapon_y,0,1)==0 and collision(cc.shaft.gfx_wpn,weapon_x,weapon_y,1,0)==1 and weapon_x>0 and weapon_x<getmapwidth() then scroll(weapon_x,weapon_y) -- draw terrainalphaimage(cc.shaft.gfx_wpn,weapon_x,weapon_y) -- effect playsound(cc.shaft.sfx_build) for i=1,10,1 do particle(p_fragment,weapon_x+math.random(-15,15),weapon_y+math.random(-12,12)) end else weapon_shots=cc.shaft.ammo end end -- draw terrainrect(weapon_x-2-13*weapon_mode,weapon_y-13,3,25,0x00000000) -- move weapon_x=weapon_x+3*weapon_mode weapon_timer=weapon_timer+1 end end end